<template>
    <div>
        <Tables :cols="cols" :data="data">
            <template v-slot:tabs='{row}'>
                <el-tag v-if="row.level==0">一级</el-tag>
                <el-tag type="success" v-if="row.level==1">二级</el-tag>
                <el-tag type="danger" v-if="row.level==2">三级</el-tag>
            </template>
        </Tables>
    </div>
</template>

<script>
import Tables from "../../components/table.vue";
import { getRolesLi } from "../../api/user.js";
export default {
  components: { Tables },
  data() {
    return {
        data:[],
      cols: [
        {
          label: "#",
          type: "index"
        },
        {
          label: "权限名称",
          name: "authName"
        },
        {
          label: "路径",
          name: "path"
        },
        {
          label: "等级",
          name: "level",
          slot:'tabs'
        }
        
      ]
    };
  },
  mounted() {
    this.getRights();
  },
  methods: {
    async getRights() {
      let res = await getRolesLi();
      console.log(res);
      this.data=res.data.data
    }
  }
};
</script>

<style lang="scss" scoped>
</style>